package CircularBufferProducerConsumer;

import java.util.concurrent.TimeUnit;

public class Consumer implements Runnable {
	private Buffer buffer;

	public Consumer(Buffer buffer) {

		this.buffer = buffer;
	}

	@Override
	public void run() {

		while (true) {
			Object ob = buffer.pop();
			System.out.println(ob.toString());
			try {
				TimeUnit.MILLISECONDS.sleep(500);
			} catch (InterruptedException e) {

				e.printStackTrace();
			}
		}
	}

}
